{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import scipy.stats as stats\n",
    "import os\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# The random walker\n",
    "\n",
    "## Brownian Motion with a Drift\n",
    "\n",
    "In lecture, we have seen the random walk described by\n",
    "\n",
    "$$dS = \\mu dt + \\sigma \\epsilon \\sqrt{dt}.$$\n",
    "\n",
    "When coding, we need to translate this to discrete timesteps, which amounts to \n",
    "\n",
    "$$\\Delta S_t = \\mu + \\sigma z_t,$$\n",
    "\n",
    "where $z_t$ is a random normal variable with mean 0 and standard deviation 1. \n",
    "\n",
    "### Visualizing the two dimensional random walker\n",
    "\n",
    "In this first example, we are going to simulate a two-dimensional random walker, like in the very first graph we have seen in the lecture slides and which we are now going to recreate. \n",
    "\n",
    "At each time step, our x- and y-coordinates are given as $X_t$ and $Y_t$, and we change them by a deterministic amount $\\mu$ and a random amount $\\sigma z_t^X$ and $\\sigma z_t^Y$, respectively.\n",
    "\n",
    "\n",
    "The position of our random walker at any given point $T$ is obtained by considering its initial position $(X_0, Y_0)$ and summing up all the changes until that point:\n",
    "\n",
    "$$X_T = X_0 + \\sum_{t=1}^T \\Delta X_t,$$\n",
    "\n",
    "and likewise for $Y_T$. Below, you find the annotated code to realize this."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X position: 96.66548467718931\n",
      "Y position: 106.17600660547429\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6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adata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Set the parameters and initial condition for the random walk.\n",
    "mu = 0.5\n",
    "sigma = 0.5\n",
    "X0 = 2.0\n",
    "Y0 = 2.0\n",
    "T = 200\n",
    "# Create T random time steps from a normal distribution.\n",
    "X = np.random.normal(0, 1, T)\n",
    "Y = np.random.normal(0, 1, T)\n",
    "\n",
    "# Insert the first step into the array and then sum up to find position \n",
    "# after each step.\n",
    "X_pos = [X0]\n",
    "Y_pos = [Y0]\n",
    "\n",
    "for t in range(0,T):\n",
    "    X_pos.append(X_pos[t] + mu + sigma*X[t])\n",
    "    Y_pos.append(Y_pos[t] + mu + sigma*Y[t])\n",
    "\n",
    "# Plot the random walk\n",
    "plt.plot(X_pos, Y_pos, \"o-\", markersize=4)\n",
    "\n",
    "# Output the position of the walker after 100 steps\n",
    "print (\"X position:\", X_pos[-1])\n",
    "print (\"Y position:\", Y_pos[-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAtAAAAFNCAYAAAApR1icAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deZxkdX3v/9cbEFEEDTBq2ByjqEFZgiOuV1HRsCi4BnCJipHohYv7dW5iiIGbBI2Gn1GuhiiLXCOiER1ZXILXXZTBgCyKbIOM44Ibu2x+fn+c00NZdHXX6e6qXng9H496TNU53zrn862e/tSnv+d7zklVIUmSJGk4G8x3AJIkSdJiYgEtSZIkdWABLUmSJHVgAS1JkiR1YAEtSZIkdWABLUmSJHVgAb2EJPlgkr+ZYn0lefiAda9M8vVh2i4E/fHO8bZfmuQLo9j2EPu+MckfzdG2/irJh9rny9uf6UZzt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EFtCRJktSBBbQkSZLUgQW0JEmS1IEFtCRJktSBBbQkSZLUwf8Ptt13UtK65BcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 864x360 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# TODO: Also get the stock prices at the middle and \n",
    "# plot the histogram for those as well\n",
    "\n",
    "def simulate_geometric_randwalk(S_0, mu, sigma, num_steps, plot=True):\n",
    "    '''Given the parameters mu and sigma,\n",
    "       num_steps and the initial value S_0,\n",
    "       generate a random walk following\n",
    "       geometric Brownian Motion.'''\n",
    "    S = np.zeros(num_steps+1)\n",
    "    # Initial value of the stock price\n",
    "    S[0] = S_0\n",
    "    # Generate random values from Gaussian distribution\n",
    "    # for each iteration step\n",
    "    rand_vals = np.random.normal(0,1,num_steps)\n",
    "    for idx in range(num_steps):\n",
    "        # Calculate the change in the iteration step\n",
    "        # according to geometric Brownian motion\n",
    "        delta_S = mu*S[idx] + sigma*rand_vals[idx]*S[idx] \n",
    "        S[idx+1] = S_0 + delta_S\n",
    "    \n",
    "    # Plot the resulting stock prices, if requested\n",
    "    if plot:\n",
    "        ax = plt.subplot(1,1,1)\n",
    "        ax.plot(S)\n",
    "        ax.set_xlabel('Iteration step')\n",
    "        ax.set_ylabel(r'Stock price, $S$')\n",
    "        ax.grid(True)\n",
    "    \n",
    "    # Return the stock prices in the middle and \n",
    "    # after all the iteration steps\n",
    "    return S[num_steps//2], S[-1]\n",
    "\n",
    "S_0 = 100\n",
    "mu = 0.08/252\n",
    "sigma = 0.14/np.sqrt(252)\n",
    "num_steps = 504\n",
    "\n",
    "#S_final = simulate_geometric_randwalk(S_0=S_0, mu=mu, sigma=sigma, num_steps=num_steps)\n",
    "#print(f'Initial stock price : {S_0}')\n",
    "#print(f'Final stock price : {S_final:.3f}')\n",
    "    \n",
    "def create_hist_stockprices(num_iter, S_0, mu, sigma, num_steps):\n",
    "    '''Generate random walk for num_iter times,\n",
    "       plot the final stock prices as a histogram.'''\n",
    "    middle_price_arr = np.zeros(num_iter)\n",
    "    final_price_arr = np.zeros(num_iter)\n",
    "    for idx in range(num_iter):\n",
    "        middle_price_arr[idx], final_price_arr[idx] = simulate_geometric_randwalk( S_0=S_0, \n",
    "                                                                                   mu=mu, \n",
    "                                                                                   sigma=sigma, \n",
    "                                                                                   num_steps=num_steps, \n",
    "                                                                                   plot=False)\n",
    "    \n",
    "    # Plot the results\n",
    "    fig, (ax1, ax2) = plt.subplots(1,2,figsize=(12,5))\n",
    "    label = r'$\\mu=\\frac{0.08}{252}$, $\\sigma=\\frac{0.28}{\\sqrt{252}}$'\n",
    "    \n",
    "    ax1.hist(middle_price_arr, density=True)\n",
    "    ax1.set_xlabel('Middle Stock Price')\n",
    "    ax1.set_ylabel('Normalized Counts')\n",
    "    ax1.set_title('Middle Stock Price Distribution')\n",
    "    \n",
    "    ax2.hist(final_price_arr, density=True) \n",
    "    ax2.set_xlabel('Final Stock Price')\n",
    "    ax2.set_ylabel('Normalized Counts')\n",
    "    ax2.set_title('Final Stock Price Distribution')\n",
    "    if not os.path.exists('./output'):\n",
    "        os.mkdir('output')\n",
    "    fig.savefig(f'./output/stock_price_dist_sigma_0_14.pdf')\n",
    "\n",
    "# Number of iterations for stock price simulation\n",
    "num_iter = 200\n",
    "\n",
    "create_hist_stockprices(num_iter=num_iter, \n",
    "                        S_0=S_0, \n",
    "                        mu=mu, \n",
    "                        sigma=sigma, \n",
    "                        num_steps=num_steps)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Distribution of the walker's final position\n",
    "\n",
    "We invoke the central limit theorem: If we look at how summed up random variables are distributed, then we are going to find the normal distribution for sufficiently large $N$.\n",
    "\n",
    "Let's see how this happens for our random walker. We are going to set $T=100$, the number of steps to take. Then we are going to collect the last position of each random walker in terms of $(X_T, Y_T)$. Finally, we plot the histograms of both."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mean of final X position: 2.012948604774527\n",
      "Mean of final Y position: 2.0075255217087484\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAskAAAEvCAYAAAC3wFzvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAaCklEQVR4nO3df4xl51kf8O/TdW2koIDBK1W1vewmLCpLQ+0yOK0iEgROWNfUzh+JYkdUpgStXMUQlKZlIalDTSMtiQREwhWxgiuguG5Iirqql7qhSRAIDDtOHCLbdVkvSzwxFUs2Ja0SbNZ5+sfcdW+OZ3furGfuj5nPRxr5nnPec+cZyXn8zXvec051dwAAgP/vb8y6AAAAmDdCMgAADAjJAAAwICQDAMCAkAwAAANCMgAADFwy6wKGrrjiit67d++sywC4KA8//PBfdPfuWdcxTfo2sKgu1LPnLiTv3bs3y8vLsy4D4KJU1Z/OuoZp07eBRXWhnm25BQAADAjJAAAwICQDAMCAkAwAAANCMgAADAjJAAAwICQDAMCAkAwAAANCMgAADAjJAAAwICQDAMDAJbMuABbd3sMPnPfYqSM3TrESACahbzMJM8kAADAgJAMAwICQDLDNVNXBqnqiqk5U1eE1jt9eVZ+pqkeq6ner6sBo/96q+vJo/yNV9YvTrx5gPliTDLCNVNWuJHcneW2SlSTHq+podz82Nuy+7v7F0fibkvxskoOjY0929zXTrBlgHplJBtherktyortPdvezSe5PcvP4gO7+4tjmS5L0FOsDWAhCMsD2cmWSp8a2V0b7vkpVvbWqnkzy3iQ/OnZoX1V9qqp+u6q+a2tLBZhfQjLA9lJr7HvBTHF3393dL0/y40neNdr9Z0n2dPe1Sd6e5L6qeumav6TqUFUtV9Xy6dOnN6l0gPkxUUh2EwjAwlhJcvXY9lVJnr7A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kf97dD1fVd8+6ng24JMnfT/Ij3f0HVfX+JIeT/KvZlsW06dkzp2dP0QL37GRB+7aQPKa7r19rf1W9Ism+JJ+uqmT18tcnq+q67v5fUyxxTeer+5yqui3J9yf53p7vZ/5N/ErceVNVfzOrzfbXuvs/zbqeCb0qyU1V9Y+SfE2Sl1bVv+/uH5hxXetZSbLS3edmfj6c1WbLDqNnz5yePV2L2rOTBe3bnpN8EarqVJKl7v6LWdeynqo6mORnk7ymu0/Pup4LqapLsnqjyvcm+VxWX6/75u5+dKaFraNW/yv8y0nOdPePzbqeizGalXhHd3//rGuZRFX9TpIf7u4nquqnkryku//FjMtiTunZW0PPnp1F69nJYvZtM8nb3y8kuSzJR0czKg919+2zLWlt53ud7ozLmsSrkvyTJJ+pqkdG+35y9NYztsaPJPm1qro0yckk/3TG9cBm0bO3np49GwvXt80kAwDAgKdbAADAgJAMAAADQjIAAAwIyQAAMCAkAwDAgJAMAAADQjIAAAwIyQAAMPD/APQkunIdn/THAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 864x360 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Variable to keep track of our final positions\n",
    "final_positions = []\n",
    "\n",
    "# For-Loop to run the walker from the same initial conditions\n",
    "# over and over again.\n",
    "for run in range(5000):\n",
    "    mu = 0.0\n",
    "    sigma = 0.2\n",
    "    X0 = 2.0\n",
    "    Y0 = 2.0\n",
    "    T = 100\n",
    "\n",
    "    # Create T random time steps from a normal distribution.\n",
    "    X = np.random.normal(0, 1, T)\n",
    "    Y = np.random.normal(0, 1, T)\n",
    "\n",
    "    # Insert the first step into the array and then sum up to find position \n",
    "    # after each step.\n",
    "    X_pos = [X0]\n",
    "    Y_pos = [Y0]\n",
    "\n",
    "    for t in range(T):\n",
    "        X_pos.append(X_pos[t] + mu + sigma*X[t])\n",
    "        Y_pos.append(Y_pos[t] + mu + sigma*Y[t])\n",
    "\n",
    "        # Append to the end of our list of the final positions\n",
    "        # the respective last positions of X and Y.\n",
    "        final_positions.append([X_pos[-1], Y_pos[-1]])\n",
    "\n",
    "# The variable final_positions is a list, but we prefer a numpy array\n",
    "final_positions = np.array(final_positions)\n",
    "\n",
    "# final_position is now a 2-dimensional array.\n",
    "# One dimension is X and Y, and the other is the 5000 runs.\n",
    "X_final = final_positions[:, 0]\n",
    "Y_final = final_positions[:, 1]\n",
    "\n",
    "# We're plotting a histogram for the final position to identify the distribution.\n",
    "# Sometimes it's useful to create subplots to put two plots next to each other:\n",
    "fig, (ax1, ax2) = plt.subplots(1,2, figsize=(12,5))\n",
    "\n",
    "# We use 41 bins spanning from -5 to 7, and we tell pyplot to return the PDF, not the counts.\n",
    "ax1.hist(X_final, bins=np.linspace(-5,7,41), density=True);\n",
    "print(\"Mean of final X position:\", np.mean(X_final))\n",
    "ax2.hist(Y_final, bins=np.linspace(-5,7,41), density=True);\n",
    "print(\"Mean of final Y position:\", np.mean(Y_final))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Problem 1.\n",
    "\n",
    "See if you can find the relationship\n",
    "\n",
    "$$\\langle x_t^2\\rangle = 2Dt$$\n",
    "\n",
    "where $t$ is the number of steps."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Stock Prices & Brownian Motion.\n",
    "\n",
    "#### Problem 2. \n",
    "Use \n",
    "\n",
    "$$\\Delta S_t = \\mu + \\sigma z_t$$ \n",
    "\n",
    "to simulate \"stock prices\" for 100 time steps. Initialize them with $S_0 = 100$ and try out different parameters. Plot your results.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RESULTS:\n",
      "Initial stock price: 100.000\n",
      "Final stock price: 119.704\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEGCAYAAABy53LJAAAABHNCSVQ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qjsR1p/b/c+q8gGseiPOB6511Fc0GHhaRlSLypIgkOOWPALtUdaiqPiQiU3DNqTASGAoMF5EJTt0+wCuqOhjIAX7q7cYaY2Mcxpy778qf+SMiu4DPnfJNwCTn/cVAf9dTHwBoJSKRzjwoAKhqkvPokylO/e9EZAxwssLnTXFe653llrgSyT5gv6qucMr/hWsyI591r5nAZInDmHPn/qyjMrflMk7/jgUBY1S1YhI4g6rm4XqS6wciUgZMw/X0YncC/EFV/3lGoWtOlYqDljaIabzOuqqMqR+fAz8vX3AeOngGERnnNj90GK4pi/cCuUCkW9XPgB8586ggInEiUj5ZT1fnLAVgOrDc2w0xxhKHMfXjXmCEM2i9GbjHQ52ewNcisglXN9Ra4H1VzQJWiEiyiDyjqp8D/wZWOnXf43Ri2QLMEJGNuJ4AW+d5pY2pjF2Oa0wT4XRV2WW7xufsjMMYY0yt2BmHMcaYWrEzDmOMMbViicMYY0ytWOIwxhhTK5Y4jDHG1IolDmOMMbXy/wHdz1/Amx1juwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "T = 100\n",
    "mu = 0.2 # drift parameter\n",
    "sigma = 0.5\n",
    "S_0 = 100\n",
    "stock_prices = np.zeros(T+1)\n",
    "stock_prices[0] = S_0\n",
    "\n",
    "# Pick T random walks from the normal distribution\n",
    "z = np.random.normal(0,1,T)\n",
    "\n",
    "for i in range(T):\n",
    "    add_term = stock_prices[i] + mu + sigma*z[i]\n",
    "    stock_prices[i+1]= add_term\n",
    "\n",
    "fig, ax = plt.subplots(1,1)\n",
    "legend_label = r'$\\mu = {mu}$, $\\sigma = {sigma}$'.format(mu=mu, sigma=sigma)\n",
    "ax.plot(stock_prices, label=legend_label)\n",
    "ax.set_ylabel('Stock Price')\n",
    "ax.set_xlabel('Time Step')\n",
    "ax.grid(True)\n",
    "plt.legend()\n",
    "\n",
    "print('RESULTS:')\n",
    "print('Initial stock price: %.3f' % stock_prices[0])\n",
    "print('Final stock price: %.3f' % stock_prices[-1])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Central Limit Theorem\n",
    "\n",
    "Consider $N$ variables $x_n$ whose distributions $p_n(x_n)$ have finite moments which are confined as $N$ grows. Then, the distribution of the scaled variable $y=\\frac{1}{\\sqrt{N}}\\sum_n x_n$ converges for large $N$, independent of the particular functional form of the distributions $p_n(x_n)$, to a Gaussian whose variance is given by the mean second moment of the distributions $p_n(x_n)$.\n",
    "\n",
    "#### Problem 3.\n",
    "\n",
    "Test the central limit theorem by testing out various distributions, such as the normal distribution, the log-normal distribution, Student's t-distribution, and the Cauchy distribution. Plot histograms to make your point."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAskAAAEvCAYAAAC3wFzvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df6zd913f8ecLZwlSoRDIZYw4rt3iSnUoSuCSMFUUBmnrNMzOpCKSqlsYnbygWO0U0OrQKmXuOoVUa2HCpfVKJGAEE5qVXRF3odCWUUFa37RpMjt4ddzQuO7USxM1QwlJnb73x/lec/LNse/X9vl1z30+pCt/v5/v53Pu+9x7Pr7v74/P55OqQpIkSdI/+JZJByBJkiRNG5NkSZIkqcUkWZIkSWoxSZYkSZJaTJIlSZKkFpNkSZIkqeW8SQfQdtFFF9XGjRsnHYY0Ne6///6/raq5ScdxKvZZ6fmmuc/aX6XnO11/nbokeePGjSwuLk46DGlqJPmbScdwOvZZ6fmmuc/aX6XnO11/9XELSZIkqcUkWZIkSWoxSZYkSZJaTJIlSZKkFpNkSZIkq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VsbvjTO2Mem8VPGsSfJtwN3Av6uqJycdz2p0uv4D/DLw2vFGdGqruK+vuj467X0ryU8DX62q+5P8xKTjGbYV+uVvAu+i9xl6F/Cf6SWiz3uJAW2H+pkbUn98VVUdT/I9wMeS/HVV/a9hxtnnXJYXH5sV+t5ngZdU1d81z6L/Eb3HGsZppd/ZWH+GJskrqKqrTnc8yQ3ATwM/VbM5n17npYpnSZJ/RO8/kt+rqv8+6XhWq1P1nySvBDYBn2/uNq4HPpvkiqr6v2MM8aRV3NdXVR9dJX3rVcC2JlH4VuDFSf5bVb1pwnENxUqf9WVJ/iswaNDiyD9zw+iPVXW8+ferST5C75GIUSXJ57K8+Fis1Pf6k+aq2p/k/Ukuqqq/HVeMHX5nY/3/zsctzkGSrcDbgG1V9dSk4xmRLkumzpTmGbHfAh6uqvdOOp5ZVFUPVdX3VNXGqtpI7z++H5pUgrySKe/rq6aPrpa+VVW3VNX65rN5Hb1loGciQV5J6/nOfwH87wHVJvqZ69Ifk7woybcvb9O7azXovQzLuSwvPnJd+l6S711+RjrJFfRyxK+NI77me3b5nS0A/6qZ5eJHga9X1VdGFZNXks/NbwAX0LslAHBfVd042ZCG61RLpk44rFF7FfAvgYeSPNCU/fKgUd5aM6a2r6+yPmrfmn63J7mM3i3sR4F/C5Dk+4APVdXrp+AzN7A/9scI/GPgI83x84A7q+p/jiqgU/1M0mF58TEZ2PeADU38H6CXuP9CkhPA08B1Y75rNvB3luTGvhj3A68HjgBPAf96lAG54p4kSZLU4uMWkiRJUnVKOfsAAAA2SURBVItJsiRJktRikixJkiS1mCRLkiRJLSbJkiRJUotJsiRJktRikixJkiS1mCRLkiRJLf8fXcexeKu0b04AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 864x360 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def plot_normal_dist(num_samples_list):\n",
    "    '''Given a list of number of samples to be drawn from, plot normal distribution.'''\n",
    "    fig, axes = plt.subplots(1,3,figsize=(12,5))\n",
    "    for idx,  num_samples in enumerate(num_samples_list):\n",
    "        # Draw from the normal distribution\n",
    "        dist = np.random.normal(0, 1, int(num_samples))\n",
    "        axes[idx].hist(dist, density=True)\n",
    "        \n",
    "num_samples_list = [1e3, 1e5, 1e7]\n",
    "\n",
    "plot_normal_dist(num_samples_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
